USE [DeviceTesting]
GO

/****** Object:  Table [dbo].[answers]    Script Date: 15.03.2015 0:40:17 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[answers](
	[idInt] [bigint] PRIMARY KEY,
	[data] [tinyint] NOT NULL,
	[testId] [int] NOT NULL,
	[deviceId] [int] NOT NULL
) ON [PRIMARY]

GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[messages](
	[id] [bigint] NOT NULL,
	[fh] [tinyint] NOT NULL,
	[deviceCode] [tinyint] NOT NULL,
	[operation] [int] NOT NULL,
	[data] [int] NOT NULL,
	[fk] [tinyint] NOT NULL,
	[crc] [int] NOT NULL,
	[testId] [int] NOT NULL,
	[orderNumber] [int] NOT NULL,
	[out] [bit] NOT NULL,
 CONSTRAINT [PK_messages] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

USE [DeviceTesting]
GO

/****** Object:  Table [dbo].[tests]    Script Date: 15.03.2015 0:45:34 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[tests](
	[testId] [bigint] NOT NULL,
	[deviceId] [int] NOT NULL,
	[descr] [nvarchar](max) NULL,
 CONSTRAINT [PK_tests] PRIMARY KEY CLUSTERED 
(
	[testId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO


USE [DeviceTesting]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[answers](
	[stateId] int NOT NULL,
	[id] [bigint] NOT NULL,
	[fh] [tinyint] NOT NULL,
	[deviceCode] [tinyint] NOT NULL,
	[operation] [int] NOT NULL,
	[data] [int] NOT NULL,
	[fk] [tinyint] NOT NULL,
	[crc] [int] NOT NULL,
	[testId] [int] NOT NULL,
	[orderNumber] [int] NOT NULL,
	[out] [bit] NOT NULL,
 CONSTRAINT [PK_answers] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

